
#include "container/queue.h"
#include <stdio.h>

void queue_list(void)
{
    cotQueue_t queue;
    uint8_t buf[200];

    printf("\n----------queue_list-------------\n");

    cotQueue_Init(&queue, buf, 200, sizeof(int));
    
    int test;
    
    test = 15;
    cotQueue_Push(&queue, &test, sizeof(int));
    test = 100;
    cotQueue_Push(&queue, &test, sizeof(int));

    printf("add after:\n");
    
    while (!cotQueue_Empty(&queue))
    {
        int val = COT_Queue_Front(queue, int);// *(int *)cotQueue_Front(&queue);
        cotQueue_Pop(&queue);
        
        printf("    size[%ld] val = %d\n", cotQueue_Size(&queue), val);
    }

    test = 800;
    cotQueue_Push(&queue, &test, sizeof(int));
    test = 1080;
    cotQueue_Push(&queue, &test, sizeof(int));
    


    cotQueue_t queue2;
    uint8_t buf2[200];

    cotQueue_Init(&queue2, buf2, 200, sizeof(int));


    cotQueue_Swap(&queue, &queue2);

    printf("sawp after:\n");

    printf("  queue-1:\n");

    while (!cotQueue_Empty(&queue))
    {
        int val = COT_Queue_Front(queue, int);
        cotQueue_Pop(&queue);
        
        printf("    size[%ld] val = %d\n", cotQueue_Size(&queue), val);
    }
    
    printf("  queue-2:\n");
    while (!cotQueue_Empty(&queue2))
    {
        int val = COT_Queue_Front(queue2, int);
        cotQueue_Pop(&queue2);
        
        printf("    size[%ld] val = %d\n", cotQueue_Size(&queue2), val);
    }
}
